package com.hongyuan.sellfitness.ui.home.view_mode;

import android.os.Bundle;

import androidx.annotation.NonNull;
import androidx.databinding.ObservableField;

import com.hongyuan.mvvmhabitx.binding.command.BindingAction;
import com.hongyuan.mvvmhabitx.binding.command.BindingCommand;
import com.hongyuan.sellfitness.base.ItemViewModel;
import com.hongyuan.sellfitness.ui.home.activity.StoreGroupDetailActivity;
import com.hongyuan.sellfitness.ui.home.beans.GroupClassBean;

public class HomeGroupItemViewModel extends ItemViewModel<FragmentHomeViewModel> {

    public ObservableField<GroupClassBean.ListBean> entity = new ObservableField<>();

    public HomeGroupItemViewModel(@NonNull FragmentHomeViewModel viewModel,GroupClassBean.ListBean bean) {
        super(viewModel);

        entity.set(bean);
    }

    //条目的点击事件
    public BindingCommand goDetails = new BindingCommand(new BindingAction() {
        @Override
        public void call() {
            Bundle bundle = new Bundle();
            bundle.putString("cs_id",String.valueOf(entity.get().getCs_id()));
            viewModel.startActivity(StoreGroupDetailActivity.class,bundle);
        }
    });

}
